<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<html>
<head>
<title>合格证修改</title>
<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js"
	type="text/javascript"></script>
<script src="${contextPath}/scripts/common.js" type="text/javascript"></script>
<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js"
	type="text/javascript"></script>
<link href="${contextPath}/styles/default.css" rel="stylesheet"
	type="text/css" />
<script src="${contextPath}/scripts/scriptvalidator.js" type="text/javascript"></script>
<script type="text/javascript">
	function updateSubmit(){
		var form=document.form;
		var money = document.getElementById("money").value;
		while(money.indexOf(",")>-1){
			money = money.replace(",","");
		}
		document.getElementById("money").value = money;
		if(Validator.Validate(form, 3)) {
			document.getElementById("form").action="${contextPath}/cm/updateSubmit.do";
			document.getElementById("form").submit();
		}
	}
	function updateSave(){
		var form=document.form;
		var money = document.getElementById("money").value;
		while(money.indexOf(",")>-1){
			money = money.replace(",","");
		}
		document.getElementById("money").value = money;
		if(Validator.Validate(form, 3)) {
			document.getElementById("form").action="${contextPath}/cm/updateSave.do";
			document.getElementById("form").submit();
		}
	}
	function checkdate(start,end){   
		 //得到日期值并转化成日期格式，replace(/\-/g, "\/")是根据验证表达式把日期转化成长日期格式，这样
		 //再进行判断就好判断了
			var sDate = new Date(start.value.replace(/\-/g, "\/"));
		    var eDate = new Date(end.value.replace(/\-/g, "\/"));
		    if(sDate > eDate){
		    	alert("结束日期不能小于开始日期");
		    	end.value="";
		    	end.focus();
		    	return false;
		    }
		    return true;
		 }
</script>
</head>
<body>
<div class="navigation">
	    <span><a href="javascript:window.history.back();"><img src="${contextPath}/images/back_nav_btn.png" /></a>
	    <a href="javascript:window.history.back();">返回</a>
	    <a href="javascript:window.history.forward();"><img src="${contextPath}/images/go_nav_btn.png" /></a>
	     <a href="javascript:window.history.forward();">前进</a>
	    <a href="javascript:window.location.reload();"><img src="${contextPath}/images/refresh_nav_btn.png" /></a>
	     <a href="javascript:window.location.reload();">刷新</a>
	    </span>合格证管理&gt;&gt;合格证修改
    </div>
<div class="xt_main_right_center">
<form action="" name="form" id="form">
<input type="hidden" name="redirectUrl" value='<s:property value='redirectUrl'/>'/>
<input type="hidden" value="${cer.id }" name="c.certification.id"/>
<input type="hidden" value="${c.id }" name="c.id"/>
<input type="hidden" value="0" name="at"/>
	<table width="100%" border="0" cellpadding="1" cellspacing="1">
		<tr>
			<td class="right-td-width-bg">渠道：</td>
			<td>${cer.brand.name }</td>
			<td>
			   <s:select cssClass="input" list="cer.shop.brands" name="c.brand.id" value="c.brand.id"  theme="simple"  listKey="id" listValue="name"/>
			</td>
		</tr>
		<tr>
			<td class="right-td-width-bg">金融机构：</td>
			<td>${cer.financial.name }</td>
			<td>
			   <s:select cssClass="input" list="fiList" name="c.financial.id" value="c.financial.id" theme="simple" listKey="id" listValue="name"/>
			</td>
		</tr>
		<tr>
			<td class="right-td-width-bg">店号：</td>
			<td>
				${cer.shop.shopMark }
			</td>
			<td><input type="hidden" value="${cer.shop.id }" name="c.shop.id"/>${cer.shop.shopMark }</td>
		</tr>
		<tr>
			<td class="right-td-width-bg">汇票号：</td>
			<td>${cer.draft }</td>
			<td><input class="input" type="text" name="c.draft" value="${c.draft }"/></td>
		</tr>
		<tr>
			<td class="right-td-width-bg">店名：</td>
			<td>
				${cer.shop.shopName }
			</td>
			<td>${cer.shop.shopName }</td>
		</tr>
		<tr>
			<td class="right-td-width-bg">订单号：</td>
			<td>${cer.orderNumber }</td>
			<td><input class="input" type="text" name="c.orderNumber" value="${c.orderNumber }"/></td>
		</tr>
		<tr>
			<td class="right-td-width-bg">车型：</td>
			<td>${cer.motorcycleType }</td>
			<td><input class="input" type="text" name="c.motorcycleType" value="${c.motorcycleType }"/></td>
		</tr>
		<tr>
			<td class="right-td-width-bg">出门日：</td>
			<td><s:date name="cer.goingOutDate" format="yyyy-MM-dd"/></td>
			<td>
				<input class="Wdate" name="c.goingOutDate" id="goingOutDate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly value="<s:date name="c.goingOutDate" format="yyyy-MM-dd"/>" onblur="checkdate(this,document.getElementById('scheduledDate'))"/>
			</td>
		</tr>
		<tr>
			<td class="right-td-width-bg">车架号：</td>
			<td>${cer.chassis }</td>
			<td><input class="input" type="text" maxlength="17" name="c.chassis" value="${c.chassis }" msg="请输入车架号|车架号验证  能为数字或字母 长度为17" dataType="Require|Chassis"/></td>
		</tr>
		<tr>
			<td class="right-td-width-bg">预定到店日：</td>
			<td><s:date name="cer.scheduledDate" format="yyyy-MM-dd"/></td>
			<td>
				<input class="Wdate" name="c.scheduledDate" id="scheduledDate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly value="<s:date name="c.scheduledDate" format="yyyy-MM-dd"/>" onblur="checkdate(document.getElementById('goingOutDate'),this)"/>
			</td>
		</tr>
		<tr>
			<td class="right-td-width-bg">合格证号：</td>
			<td>${cer.certificationNum }</td>
			<td><input class="input" type="text" maxlength="15" name="c.certificationNum" value="${c.certificationNum }" <s:if test="c.certificationNum.length()>0">msg="请输入合格证号|合格证号必须为15位" dataType="Require|certificationNum"</s:if>/></td>
		</tr>
		<tr>
			<td class="right-td-width-bg">供货价：</td>
			<td align="left"><s:property value="formatAmount(cer.supplyPrice)"/></td>
			<td><input class="input" type="text" name="c.supplyPrice" value="${c.supplyPrice }" msg="供货价格式错误(最大到千万位)" dataType="DoubleMoney" id="money"/></td>
		</tr>
		<tr>
			<td class="right-td-width-bg">汇票起始日：</td>
			<td><s:date name="cer.draftBeginDate" format="yyyy-MM-dd"/></td>
			<td>
				<input class="Wdate" name="c.draftBeginDate" id="draftBeginDate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly value="<s:date name="c.draftBeginDate" format="yyyy-MM-dd"/>" onblur="checkdate(this,document.getElementById('draftEndDate'))"/>
			</td>
		</tr>
		<tr>
			<td class="right-td-width-bg">汇票到期日：</td>
			<td><s:date name="cer.draftEndDate" format="yyyy-MM-dd"/></td>
			<td>
				<input class="Wdate" name="c.draftEndDate" id="draftEndDate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly value="<s:date name="c.draftEndDate" format="yyyy-MM-dd"/>" onblur="checkdate(document.getElementById('draftBeginDate'),this)"/>
			</td>
		</tr>
		<tr>
			<td class="right-td-width-bg"><font  color="red" size="2">* </font>申请理由：</td>
			<td colspan="2" >
			 <textarea name="c.reson" cols="30" rows="5" id="textfield" dataType="Require" msg="申请理由">${c.reson }</textarea>
			</td>
		</tr>
		<tr>
			<td colspan="4" align="center">
				<input type="button" class="btn_submit" value="" onclick="updateSubmit()"/>
				<input type="button" class="btn_temporary" value="" onclick="updateSave()"/>
     		    <input type="reset" class="btn_rest" value=""/>
			</td>
		</tr>
	</table>
</form>
</div>
</body>
</html>